package com.zzyl.baidu;

import okhttp3.*;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * @Description Picture
 * @Author cangyue
 * @Date 2025-07-16
 */
public class Picture {

    public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().readTimeout(300, TimeUnit.SECONDS).build();

    public static void main(String []args) throws IOException {
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\"prompt\":\"参考仅改变动作，其他不变生成一张同风格的角色\",\"model\":\"irag-1.0\",\"refer_image\":\"http://hbimg.huaban.com/102a2633e928b84ec138e4152b3a5c41352ca6d21728a-QI3dFV\"}");
        Request request = new Request.Builder()
                .url("https://qianfan.baidubce.com/v2/images/generations")
                .method("POST", body)
                .addHeader("Content-Type", "application/json")
                .addHeader("Authorization", "Bearer bce-v3/ALTAK-LcyNIdVp4cpGaUPGEePl3/2c4d5a5cbc1c82b4a2e9b65ebadb5196efd30f77")
                .build();
        Response response = HTTP_CLIENT.newCall(request).execute();
        System.out.println(response.body().string());

    }
}
